<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h1>右键菜单</h1>
  <script src="./index.js" type="text/javascript" charset="utf-8"></script>
  <script>
    const remote = require("@electron/remote");
    const rightMenuTemplate = [
      {
        label: '复制',
        accelerator: 'ctrl+c'
      },
      {
        label: '粘贴',
        accelerator: 'ctrl+v'
      }
    ]
    const menu = remote.Menu.buildFromTemplate(rightMenuTemplate)
    window.addEventListener("contextmenu", (e) => {
      e.preventDefault()
      menu.popup({
        window: remote.getCurrentWindow()
      })
    })
  </script>
</body>
</html>
